from django.db import models
from conference.models import Conference
from person.models import Person
from chushi.models import Chushi

# Create your models here.


class StateChoices(models.TextChoices):
    送审="送审"
    通过="通过"
    驳回="驳回"
    上会="上会"
    完结="完结"



class ConferenceType(models.TextChoices):  # 会议类型
    EXECUTIVE = "常务会议"
    PLENARY = "全体会议"
    OFFICE = "办公会议"
    SPECIAL = "专题会议"
    PARTY = "党务会议"
    WORKING = "工作会议"



class Issue(models.Model):  # 议题
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255, blank=True, null=True)
    
    report_time = models.DateTimeField(blank=True, null=True)  # 申报时间
    preset_time = models.DateTimeField(blank=True, null=True)  # 预安排时间

    publicity = models.BooleanField(blank=True, null=True)  # 是否公开
    distribut = models.BooleanField(blank=True, null=True)  # 材料发放
    # state = models.CharField(
    #     max_length=255, choices=State_Choices.choices, blank=True, null=True
    # )  # 审核状态
    state = models.CharField(max_length=6,choices=StateChoices.choices,default=StateChoices.送审, blank=True, null=True)  # 审核状态
    proposal = models.CharField(max_length=2048, blank=True, null=True)  # 复合建议
    type = models.CharField(
        max_length=12,
        choices=ConferenceType.choices,
        default=ConferenceType.EXECUTIVE,
        blank=True,
        null=True,
    )
    conference_id = models.ForeignKey(  # 对应会议
        Conference,
        on_delete=models.CASCADE,
        related_name="issue",
        blank=True,
        null=True,
    )
    shenghe_person = models.ForeignKey(  # 审核人
        Person, on_delete=models.CASCADE, related_name="shenghe_issue", blank=True, null=True
    )
    huibao_person = models.ForeignKey(  # 汇报人
        Person, on_delete=models.CASCADE, related_name="huibao_issue", blank=True, null=True
    )
    chengban_person = models.ForeignKey(  # 承办人
        Person, on_delete=models.CASCADE, related_name="chengban_issue", blank=True, null=True
    )
    chushi_id = models.ForeignKey(  # 承办处室
        Chushi, on_delete=models.CASCADE, related_name="issue", blank=True, null=True
    )
